package com.shuhe.utils;

import com.shuhe.JettyServer;
import com.shuhe.metastore.DBSql;

import java.sql.Connection;
import java.sql.ResultSet;

public class ChineseToPinyin {

    public static void main(String[] args) {
        try {
            JettyServer jettyServer = new JettyServer();
            String sql = "SELECT\n" +
                    "\ttable_catalog,\n" +
                    "\ttable_schema,\n" +
                    "\tTABLE_NAME,\n" +
                    "\tCOLUMN_NAME,\n" +
                    "\tordinal_position,\n" +
                    "\tdata_type,\n" +
                    "\tcharacter_maximum_length \n" +
                    "FROM\n" +
                    "\tinformation_schema.COLUMNS \n" +
                    "WHERE\n" +
                    "\ttable_catalog = 'postgres' \n" +
                    "\tAND table_schema = 'za' \t\n" +
                    "ORDER BY\n" +
                    "\ttable_name,\n" +
                    "\tordinal_position";

            Connection dbConn = DBSql.connect();
            ResultSet rs = DBSql.querySql(dbConn, sql);
            String table_name = "";
            while (rs.next()) {
                if (table_name.length() <= 0 || table_name.equals(rs.getString("table_name"))) {
                    //第一行，用一张表
                    table_name = rs.getString("table_name");
                    String table_catalog = rs.getString("table_catalog");
                    String table_schema = rs.getString("table_schema");
                    String COLUMN_NAME = rs.getString("COLUMN_NAME");
                    String ordinal_position = rs.getString("ordinal_position");
                    String data_type = rs.getString("data_type");
                    String character_maximum_length = rs.getString("character_maximum_length");
                } else {
                    //新表
                }


            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }


    }
}
